package com.bjb.vr.common.dto;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 数据同步表，保存云端服务变更的SQL语句。本地服务不需要使用，此表也不会进行同步
 * @TableName sync_data
 */
@TableName(value ="sync_data")
@Data
public class SyncData extends BaseModel implements Serializable {
    /**
     * 主键ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 租户ID
     */
    @TableField(value = "tenant_id")
    private String tenantId;

    /**
     * 数据ID用于同步
     */
    @TableField(value = "data_id", fill = FieldFill.INSERT)
    private Long dataId;

    /**
     * SQL语句类型
     */
    @TableField(value = "event_type")
    private String eventType;

    /**
     * 数据库名称
     */
    @TableField(value = "db_name")
    private String dbName;

    /**
     * 数据库表名称
     */
    @TableField(value = "table_name")
    private String tableName;

    /**
     * SQL语句
     */
    @TableField(value = "statement")
    private String statement;

    /**
     * SQL语句MD5值
     */
    @TableField(value = "md5")
    private String md5;

    /**
     * 创建时间
     */
    @TableField(value = "gmt_create", fill = FieldFill.INSERT)
    private LocalDateTime gmtCreate;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @TableField(exist = false)
    private String username;

    @TableField(exist = false)
    private String roleName;
}